import { request } from 'umi';

import {
  CardListParamsType,
  CardTypeReturnType,
  AddCardParamsType,
  DelteCardParamsType,
  CardInfoParamsType,
  ActivateCardParamsType,
  LossCardParamsType,
  RestoreCardParamsType,
} from './API';

export async function queryUnboundUserList() {
  return request<API.APIReturnType<any>>('/api/user/unboundUserList');
}
export async function queryCardList(params: CardListParamsType) {
  return request<API.APIReturnType<any>>('/api/card/list', { params });
}
export async function queryCardType() {
  return request<API.APIReturnType<CardTypeReturnType>>('/api/card/cardType');
}
export async function queryCardInfo(params: CardInfoParamsType) {
  return request<API.APIReturnType<CardTypeReturnType>>('/api/card/info', { params });
}
export async function addCardAPI(params: AddCardParamsType) {
  return request<API.APIReturnType<any>>('/api/card/add', { method: 'post', data: { ...params } });
}
export async function stopCardAPI(params: LossCardParamsType) {
  return request<API.APIReturnType<any>>('/api/card/stop', {
    method: 'post',
    data: { ...params },
  });
}
export async function restoreCardAPI(params: RestoreCardParamsType) {
  return request<API.APIReturnType<any>>('/api/card/restore', {
    method: 'post',
    data: { ...params },
  });
}
export async function activateCardAPI(params: ActivateCardParamsType) {
  return request<API.APIReturnType<any>>('/api/card/activate', {
    method: 'post',
    data: { ...params },
  });
}
export async function deleteCardAPI(params: DelteCardParamsType) {
  return request<API.APIReturnType<any>>('/api/card/delete', {
    method: 'post',
    data: { ...params },
  });
}
